package com.android.core.base;

import android.os.Bundle;

/**
 * 描述：
 * -
 * 创建人：鲍圣祥
 * 创建时间：2016/12/6
 */
public abstract class MVPBaseActivity<V, P extends BasePresenter<V>> extends BaseActivity {
    public P mPresenter; //presenter对象

    @SuppressWarnings("unchecked")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mPresenter = createPresenter();
        mPresenter.attachView((V) this,this);//view与presenter建立关联
    }

    @Override
    protected void onDestroy() {
        mPresenter.detachView();
        super.onDestroy();
    }

    protected abstract P createPresenter();


}
